from django.contrib import admin
# 导入Post数据模型
#from .models import Post 
# 导入Comment数据模型
from .models import Post, Comment 
admin.site.register(Post) 

# Register your models here.
#@admin.register(Post)  
class PostAdmin(admin.ModelAdmin):
    list_display = ('title','slug','author','publish','status')
    list_filter = ('status','slug','publish','author')
    search_fields = ('title','body')
    prepopulated_fields = {'slug': ('title',)}
    raw_id_fields = ('author',)
    date_hierarchy = 'publish'
    ordering = ('status','publish')
@admin.register(Comment)
class CommentAdmin(admin.ModelAdmin): 
    # 配置在管理后台可以查看到的字段 
    list_display = ('name', 'email', 'post', 'created', 'active') 
    # 配置在管理后台可以进行过滤的字段 
    list_filter = ('active', 'created', 'updated') 
    # 配置在管理后台可以进行搜索的字段 
    search_fields = ('name', 'email', 'body')   




